home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / libndir / dir.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-02-01  |  1.2 KB  |  57 lines

  1. /* Copyright (c) 1982 Regents of the University of California */
  2.  
  3. /* @(#)ndir.h 4.4 3/30/82 */
  4.  
  5. /*
  6.  * This sets the "page size" for directories.
  7.  * Requirements are DEV_BSIZE <= DIRBLKSIZ <= MINBSIZE with
  8.  * DIRBLKSIZ a power of two.
  9.  * Dennis Ritchie feels that directory pages should be atomic
  10.  * operations to the disk, so we use DEV_BSIZE.
  11.  */
  12. #define DIRBLKSIZ 512
  13.  
  14. /*
  15.  * This limits the directory name length. Its main constraint
  16.  * is that it appears twice in the user structure. (u. area)
  17.  */
  18. #define MAXNAMLEN 255
  19.  
  20. struct    direct {
  21.     long    d_ino;
  22.     short    d_reclen;
  23.     short    d_namlen;
  24.     char    d_name[MAXNAMLEN + 1];
  25.     /* typically shorter */
  26. };
  27.  
  28. struct _dirdesc {
  29.     int    dd_fd;
  30.     long    dd_loc;
  31.     long    dd_size;
  32.     char    dd_buf[DIRBLKSIZ];
  33. };
  34.  
  35. /*
  36.  * useful macros.
  37.  */
  38. #undef DIRSIZ
  39. #define DIRSIZ(dp) \
  40.     ((sizeof(struct direct) - MAXNAMLEN + (dp)->d_namlen + sizeof(ino_t) - 1) &\
  41.     ~(sizeof(ino_t) - 1))
  42. typedef    struct _dirdesc DIR;
  43. #ifndef    NULL
  44. #define    NULL    0
  45. #endif
  46.  
  47. /*
  48.  * functions defined on directories
  49.  */
  50. extern DIR *opendir();
  51. extern struct direct *readdir();
  52. extern long telldir();
  53. extern long lseek();
  54. extern seekdir();
  55. #define rewinddir(dirp)    seekdir((dirp), 0L)
  56. extern closedir();
  57.